<template>
  <div class="page-container">
    <!-- 0：票务 1：通用-->
    <template v-if="productType === 0">
      <ScenicStep1 :type="type" :form-detail="productDetail" />
      <ScenicStep2 :form-detail="productDetail" />
    </template>
    <template v-if="productType === 1">
      <CommonStep1 :form-detail="productDetail" />
      <CommonStep2 :form-detail="productDetail" />
    </template>
  </div>
</template>

<script>
import ScenicStep1 from '@/views/shop/creatProduct/scenic/Step1.vue'
import ScenicStep2 from '@/views/shop/creatProduct/scenic/Step2.vue'
import CommonStep1 from '@/views/shop/creatProduct/common/Step1.vue'
import CommonStep2 from '@/views/shop/creatProduct/common/Step2.vue'
import { getProductDetail } from '@/api/product'

export default {
  name: 'ProductDetail',
  components: {
    ScenicStep1,
    ScenicStep2,
    CommonStep1,
    CommonStep2
  },
  data() {
    return {
      id: '',
      type: '',
      productType: '',
      productDetail: {}
    }
  },

  created() {
    const { id, productType, type } = this.$route.query
    this.id = id
    this.productType = Number(productType)
    this.type = Number(type)
    this.getDetail()
  },

  methods: {

    // 获取详情
    getDetail() {
      const data = {
        id: this.id
      }
      getProductDetail(data).then(res => {
        this.productDetail = res || {}
      }).catch(() => {})
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
